#include<stdio.h>
#include<stdio.h>
void reserve(char* zuo, char* you)
{
	while (zuo < you)
	{
		char ass = *zuo;
		*zuo = *you;
		*you = ass;
		zuo++;
		you--;
	}
	//printf("%s", arr);

}
int main()
{
	/*char arr[16] = "l like bejing.";
	char* p = &arr;
	int i = 0;
	for (i = 7;i <= 12;i++)
	{
		printf("%c", *(p + i));
	}
	printf(" ");*/
	char arr[20] = { 0 };
	gets(arr);
	reserve(arr, arr + strlen(arr) - 1);
	printf("%s\n", arr);

	char* start;
	char* end;
	start = arr;
	end = arr;
	while (*end != '\0')
	{
		while (*end != ' ' && *end != '\0')
		{
			end++;
		}
		reserve(start, end-1);
		if (*end != '\0')
		{
			end++;
			start = end;
		}
	}
	printf("%s", arr);
	return 0;
}